﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _50_MyPow
{
    class Program
    {
        static void Main(string[] args)
        {
        }

        public double MyPow(double x, int n)
        {
            double temp = x;
            if (n == 0)
                return 1;
            temp = Math.Pow(x, n / 2);
            if (n % 2 == 0)
                return temp * temp;
            else
            {
                if (n > 0)
                    return x * temp * temp;
                else
                    return (temp * temp) / x;
            }
        }
    }
}
